﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Net.Http.Headers;
using MvcSample.Data.Core;
using MvcSample.Models;

namespace MvcSample.Controllers
{
    public class BlogsController : Controller
    {
        private readonly Blog _blog;
        public BlogsController(Blog blog)
        {
            _blog = blog;
        }

        public IActionResult Create()
        {
            return View(new BlogVm(_blog));
        }
        [HttpPost]
        [IgnoreAntiforgeryToken]
        public IActionResult Create([FromForm]BlogVm blogVm,[FromHeader(Name="accept")]string accept)
        {
            return RedirectToAction(nameof(Create));
        }

    }
}